package com.hoshino.momochi.service.Impl;

import com.hoshino.momochi.mapper.UserMapper;
import com.hoshino.momochi.model.domain.User;
import com.hoshino.momochi.model.domain.UserDetails;
import com.hoshino.momochi.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public void registerUser(User user) {
        userMapper.registerUser(user);
    }

    @Override
    public User getUserByUserName(String username) {
        return userMapper.getUserByUserName(username);
    }

    @Override
    public void updateById(Long id) {
        userMapper.updateById(id);
    }

    @Override
    public void updateUsername(String username) {
        userMapper.updateUsername(username);
    }

    @Override
    public void updatePassword(String password, Long id) {
        userMapper.updatePassword(password, id);
    }

    @Override
    public void updateUsernameAndPassword(User user) {
        userMapper.updateUsernameAndPassword(user);
    }

    @Override
    public List<String> getAllUsername() {
        return userMapper.getAllUsername();
    }

    @Override
    public User getFocusAndUserDetails(Long uid) {
        return userMapper.getFocusAndUserDetails(uid);
    }

    @Override
    public Long getUserIdById(Long uid) {
        return userMapper.getUserIdById(uid);
    }

    @Override
    public void delIsDeleteAsTrue() {
        userMapper.delIsDeleteAsTrue();
    }

    @Override
    public UserDetails getUserDetailsByUserId(Long user_id) {
        return userMapper.getUserDetailsByUserId(user_id);
    }

    @Override
    public Long getUserIdByIdAndNoIsDelete(Long user_id) {
        return userMapper.getUserIdByIdAndNoIsDelete(user_id);
    }

    @Override
    public String getMailByUserId(Long user_id) {
        return userMapper.getMailByUserId(user_id);
    }
}
